<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="page">
    <h3 class="big-title">充值</h3>
    <form action="" class="page-container">
        <!--<div class="inputs clearfloat">
            <label for="optionHtml" class="">充值账号</label>
            <script id="optionScript" type="text/html">
                {{each data item index}}
                <option value="{{item.accountType}}">{{item.accountType | accountType}}：{{item.amountNum}}</option>
                {{/each}}
            </script>
            <select class="select" id="optionHtml" name="accountId">
            </select>
        </div>-->
        <div class="inputs clearfloat">
            <label for="rechargeNum" class="">充值金额</label>
            <input type="text" name="rechargeNum" id="rechargeNum">
        </div>

        <div class="edit">
            <input type="button" class="buttons" value="确认充值" onclick="submitCharge()">

        </div>
    </form>

</div>
<script src="js/jquery-1.8.3.min.js"></script>
<script src="js/layer/layer.js"></script>
<script src="js/moment-2.2.1.js"></script>
<script src="js/template-web.js"></script>
<script src="js/jdgj/config.js"></script>
<script >
    var userId = config.getUserId();
    // 加载账户信息信息
    /*template.defaults.imports.accountType = function(value){
        return config.accountType(value);
    };
    var pageNo = pageNo | 1;
    $.get(config.baseUrl + "/account/quaryAccountType.json",{userId: userId, type:1}, function(result){
        if (result.status == 200) {
            var html = template("optionScript", result);
            $("#optionHtml").html(html);
        }
    });*/
    // 充值
    function submitCharge() {
        var accountType = $("#optionHtml").val();
        var rechargeNum = $("#rechargeNum").val();
        if (rechargeNum == '' || accountType == '' ) {
            return false;
        }
        $.post(config.baseUrl + "/account/recharge.json", {
            userId: userId,
            accountType: accountType,
            rechargeNum: rechargeNum
        }, function (result) {
            console.info(result)
            debugger;
            if (result.status == 200) {
                layer.alert("充值成功");
            } else {
                layer.alert(result.msg);
            }
        }, 'json');
    }
</script>
</body>
</html>